import java.util.Arrays;
import java.util.Scanner;

public class Test2 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int aim = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        Arrays.sort(arr);
        int ret = 0;
        for (int i = arr.length-1; i >= 0; i--) {
            ret += aim / arr[i];
            aim %= arr[i];
        }
        System.out.println(aim == 0 ? ret : -1);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int aim = in.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = in.nextInt();
        }
        // dp[i][j]表示从前i个面值的货币中选择,使得金额刚好等于j的最少货币数
        // 为了区分是否可以恰好凑成j的货币,所以我们无法凑成的就用-1来表示
        int[][] dp = new int[n + 1][aim + 1];
        for (int i = 1; i <= n; i++) {
            dp[i][0] = 0;
        }
        for (int j = 1; j <= aim; j++) {
            dp[0][j] = -1;
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 0; j <= aim; j++) {
                if (dp[i - 1][j] == -1 && (j >= arr[i - 1] && dp[i][j - arr[i - 1]] == -1)) {
                    dp[i][j] = -1;
                }
                if (dp[i - 1][j] != -1) {
                    dp[i][j] = dp[i - 1][j];
                    if (j >= arr[i - 1] && dp[i][j - arr[i - 1]] != -1) {
                        dp[i][j] = Math.min(dp[i][j], dp[i][j - arr[i - 1]] + 1);
                    }
                } else {
                    if (j >= arr[i - 1]) {
                        dp[i][j] = dp[i][j - arr[i - 1]] == -1 ? -1 : dp[i][j - arr[i - 1]] + 1;
                    } else {
                        dp[i][j] = -1;
                    }
                }
            }
        }
        System.out.println(dp[n][aim]);
    }
}
